/**
 * 
 */
package edu.rice.myxo.olexii1;

import java.awt.geom.Rectangle2D;

/**
 * @author Haiyang Zhang
 * 
 */
public class ChemicalSpace {

	public ChemicalSpace(double ox, double oy, double w, double h, int sType) {
		oriX = ox;
		oriY = oy;
		width = w;
		height = h;
		signalType = sType;
		area = new Rectangle2D.Double(oriX, oriY, width, height);
	}

	public ChemicalSpace(Rectangle2D.Double sigArea, int sType) {
		area = sigArea;
		oriX = area.getX();
		oriY = area.getY();
		width = area.getWidth();
		height = area.getHeight();
		signalType = sType;
	}

	public boolean ifExternaSignals(MyxoAgent m) {
		boolean ifSignal = false;
		switch (signalType) {
		case 0:
			ifSignal = area.contains(m.getX(), m.getY());
			break;
		default:
			ifSignal = area.contains(m.getX(), m.getY());
			break;
		}
		return ifSignal;
	}
	
	public boolean ifExternaSignals(MyxoAgent2 m) {
		boolean ifSignal = false;
		switch (signalType) {
		case 0:
			ifSignal = area.contains(m.getX(), m.getY());
			break;
		default:
			ifSignal = area.contains(m.getX(), m.getY());
			break;
		}
		return ifSignal;
	}

	private double oriX;

	private double oriY;

	private double width;

	private double height;

	private Rectangle2D.Double area;

	private int signalType;

}
